<?php
include "konek.php";
// menampilkan tanggal 10 hari sebelumnya dari tanggal hari ini berdasarkan timestamp nya
$prit =date('Y/m/d');
$x1 = date("Y-m-d");
$x  = mktime(0, 0, 0, date("m"), date("d"),  date("Y"));
$day1= date("l", $x);
$feb = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$x1%'  and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb1=  mysql_fetch_array($feb);
$Low1 = $feb1['FEB'];

$x2  = mktime(0, 0, 0, date("m"), date("d"),  date("Y"));
$day1a= date("l", $x2);
$feba = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$x1%'  and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb1a=  mysql_fetch_array($feba);
$Medium1 = $feb1['FEB'];

$x2a  = mktime(0, 0, 0, date("m"), date("d"),  date("Y"));
$day1b= date("l", $x2a);
$feba2 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$x1%'  and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb1a2=  mysql_fetch_array($feba2);
$High1 = $feb1['FEB'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$nextN = mktime(0, 0, 0, date("m"), date("d") -1, date("Y"));
$next1= date("Y-m-d", $nextN);
$x3  = mktime(0, 0, 0, date("m"), date("d")-1,  date("Y"));
$xd3= date("l", $x3);

$feb2 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next1%' and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb21=  mysql_fetch_array($feb2);
$Low2 = $feb21['FEB'];

$feb2a = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next1%' and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb21a=  mysql_fetch_array($feb2a);
$Medium2 = $feb21a['FEB'];

$feb2b = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next1%' and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb21b=  mysql_fetch_array($feb2b);
$High2 = $feb21b['FEB'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$nextN1 = mktime(0, 0, 0, date("m"), date("d") -2, date("Y"));
$next12= date("Y-m-d", $nextN1);
$x4  = mktime(0, 0, 0, date("m"), date("d")-2,  date("Y"));
$xd2= date("l", $x4);

$feb3 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next12%' and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb31=  mysql_fetch_array($feb3);
$Low3 = $feb31['FEB'];

$feb3a = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next12%' and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb31a=  mysql_fetch_array($feb3a);
$Medium3 = $feb31a['FEB'];

$feb3b = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next12%' and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb31b=  mysql_fetch_array($feb3b);
$High3 = $feb31b['FEB'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$nextN2 = mktime(0, 0, 0, date("m"), date("d") -3, date("Y"));
$next13= date("Y-m-d", $nextN2);
$x5  = mktime(0, 0, 0, date("m"), date("d")-3,  date("Y"));
$xd5= date("l", $x5);

$feb4 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next13%' and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb41=  mysql_fetch_array($feb4);
$Low4 = $feb41['FEB'];

$feb4a = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next13%' and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb41a=  mysql_fetch_array($feb4a);
$Medium4 = $feb41a['FEB'];

$feb4b = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next13%' and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb41b=  mysql_fetch_array($feb4b);
$High4 = $feb41b['FEB'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$nextN4 = mktime(0, 0, 0, date("m"), date("d") -4, date("Y"));
$next14= date("Y-m-d", $nextN4);
$x6  = mktime(0, 0, 0, date("m"), date("d")-4,  date("Y"));
$xd6= date("l", $x6);

$feb5 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next14%' and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb51=  mysql_fetch_array($feb5);
$Low5 = $feb51['FEB'];

$feb5a = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next14%' and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb51a=  mysql_fetch_array($feb5a);
$Medium5 = $feb51a['FEB'];

$feb5b = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next14%' and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb51b=  mysql_fetch_array($feb5b);
$High5 = $feb51b['FEB'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$nextN5 = mktime(0, 0, 0, date("m"), date("d") -5, date("Y"));
$next15= date("Y-m-d", $nextN5);
$x7  = mktime(0, 0, 0, date("m"), date("d")-5,  date("Y"));
$xd7= date("l", $x7);

$feb6 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next15%' and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb61=  mysql_fetch_array($feb6);
$Low6 = $feb61['FEB'];

$feb6a = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next15%' and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb61a=  mysql_fetch_array($feb6a);
$Medium6 = $feb61a['FEB'];

$feb6b = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next15%' and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb61b=  mysql_fetch_array($feb6b);
$High6 = $feb61b['FEB'];

//;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$nextN6 = mktime(0, 0, 0, date("m"), date("d") -6, date("Y"));
$next16= date("Y-m-d", $nextN6);
$x8  = mktime(0, 0, 0, date("m"), date("d")-6,  date("Y"));
$xd8= date("l", $x8);

$feb7 = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next16%' and severity_level in('Low') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb71=  mysql_fetch_array($feb7);
$Low7 = $feb71['FEB'];

$feb7a = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next16%' and severity_level in('Medium') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb71a=  mysql_fetch_array($feb7a);
$Medium7 = $feb71a['FEB'];

$feb7b = mysql_query("select count(*) as FEB from ticket where open_datetime like '%$next16%' and severity_level in('High') group by(severity_level)");
//var_dump(mysql_fetch_array($jan));
$feb71b=  mysql_fetch_array($feb7b);
$High7 = $feb71b['FEB'];


echo "

<graph xAxisName='Severity Level by Month' yAxisName='' caption='Severity Level Average' subCaption='( $prit )' 
 decimalPrecision='0' rotateNames='1' numDivLines='3' numberPrefix='' showValues='0' formatNumberScale='0'>
	<categories>
		<category name='$day1 ' />
		<category name='$xd3 ' />
		<category name='$xd2 ' />
		<category name='$xd5' />
		<category name='$xd6 ' />
		<category name='$xd7 ' />
		<category name='$xd8 ' />
	</categories>
	<dataset seriesName='Low' color='AFD8F8' showValues='0'>
		<set value='$Low1' />
		<set value='$Low2' />
		<set value='$Low3' />
		<set value='$Low4' />
		<set value='$Low5' />
		<set value='$Low6' />
		<set value='$Low7' />
	</dataset>
	<dataset seriesName='Medium'  color='F6BD0F' showValues='0'>
		<set value='$Medium1' />
		<set value='$Medium2' />
		<set value='$Medium2' />
		<set value='$Medium4' />
		<set value='$Medium5' />
		<set value='$Medium6' />
		<set value='$Medium7' />
	</dataset>
	<dataset seriesName='High' color='8BBA00' showValues='0'>
		<set value='$High1' />
		<set value='$High2' />
		<set value='$High3' />
		<set value='$High4' />
		<set value='$High5' />
		<set value='$High6' />
		<set value='$High7' />
	</dataset>
</graph>



";



?>